﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YJKArchUtils.Utils;
using YJKRevitDimensionText.OneKeyPlanDim;
using YJKRevitView;

namespace YJKRevitDimensionText.Commands
{
	[Transaction(TransactionMode.Manual)]
	internal class CmdOneKeyPlanDim : IExternalCommand
	{
		public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
		{
            CmdViewType cmdViewType = (CmdViewType)15;
			if (SwitchView.SetUsableView(cmdViewType, commandData) != Autodesk.Revit.UI.Result.Succeeded)
			{
				return Autodesk.Revit.UI.Result.Failed;
			}
			HideWarningAndErroringKit @object = new HideWarningAndErroringKit(new List<string>
			{
				"newProfileDim",
				"newGridDim",
				"newWinDoorDim",
				"thickSizeDim",
				"CreateDim",
				"SizeDim"
			}, (HideWarningAndErroringKit.HideKitEnum)2);
			commandData.Application.Application.FailuresProcessing += @object.OnFailuresProcessing;
			new PlanDimensionCreateManage(commandData).Run();
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
